import Mock from "mockjs";
import { builder, getBody } from "../util";
const login = options => {
  const { name, password } = getBody(options);
  if (name == "admin" && password == "123456") {
    const loginInfo = {
      message: "登陆成功"
    };
    return builder(loginInfo, loginInfo.message, 200);
  } else {
    const loginInfo = {
      message: "账号或者密码错误"
    };
    return builder(loginInfo, loginInfo.message, 100);
  }
};

Mock.mock(/\/mock-api\/user\/login/, "post", login);
